//-------------------------------------------------------------------
//	Copyright (c) 2010-2012 Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_POST_PROCESS_INTERFACE_H
#define _UX_POST_PROCESS_INTERFACE_H

#include "../CResource.h"

namespace Engine
{
namespace Resources
{

	struct TPostProcessTexture
	{
		CTexturePtr			pTexture;
		e_pp_texture::type	eType;
		///
		TPostProcessTexture(): pTexture(), eType(e_pp_texture::UNKNOWN) {}
		TPostProcessTexture(const CTexturePtr &tex, e_pp_texture::type type): pTexture(tex), eType(type) {}
	};


	typedef array< e_pp_texture::type, TFastCopyStrategy<e_pp_texture::type> >	pptex_types_array_t;
	typedef array< TPostProcessTexture >										pptex_array_t;
	


	//
	// Post Process interface
	//

	class _EXPORT_ IPostProcess : public CEngBaseObject
	{
	protected:
		virtual void _OnAttachedFrom(IPostProcess *pPostProcess = nullptr) = 0;
		static  void _s_OnAttachedFrom(IPostProcess *pFrom, IPostProcess *pPP)		{ pFrom->_OnAttachedFrom( pPP ); }

	public:
		// input
		virtual bool GetInputTextures(pptex_types_array_t &aTexTypes) const = 0;
		virtual bool InputTexture(const CTexturePtr &pTex, e_pp_texture::type eType) = 0;
		virtual bool InputTextures(const pptex_array_t &aTextures) = 0;
		virtual void ResetInputTextures() = 0;

		// output
		virtual bool GetOutputTextures(pptex_array_t &aTextures) const = 0;

		// multipass
		virtual bool IsMultiProcess() = 0;	// true if have attached post process
		virtual bool GetAttachedPostProcess(IPostProcessBasePtr &pPostProcess) = 0;
		virtual bool AttachToLast(const IPostProcessBasePtr &pPostProcess, uint uIndex = 0) = 0;
		virtual bool AttachPostProcess(const IPostProcessBasePtr &pPostProcess, uint uIndex = 0) = 0;
		virtual bool DetachPostProcess() = 0;
		
		virtual bool CheckStatus() = 0;
		virtual bool Process(uint uIndex = 0, bool bToScreen = true) = 0;
		virtual uint GetMaxIndex() = 0;

		virtual bool GetPostProcess(IPostProcessBasePtr &pPostProcess) = 0;
	};



	//
	// Post Process Base interface
	//

	class _EXPORT_ IPostProcessBase : public CResource
	{
	public:
		IPostProcessBase(const char *pFileName): CResource(pFileName) {}
		virtual ~IPostProcessBase() {}

		virtual bool GetPostProcess(IPostProcessPtr &) = 0;

		virtual e_post_process::type GetPostProcessType() const = 0;
	};

//-------------------------------------------------------------------

}	// Resources
}	// Engine

#endif	// _UX_POST_PROCESS_INTERFACE_H